package algorithms.que14;

import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.Stopwatch;

/**
 * @功能
 * @创建时间 2020/9/14
 */
public class E1d4d37A {
    public static double timeTrial(long N)
    {
        FixedCapacityStackOfInts sInts=new FixedCapacityStackOfInts(1);
        Stopwatch timer=new Stopwatch();
        for(long i=0;i<N;i++)
        {
            sInts.push(1);
            sInts.pop();
        }
        return timer.elapsedTime();
    }

    public static void main(String[] args)
    {
        double prev=timeTrial(50);
        for (long N=100;N<Long.MAX_VALUE/2;N+=N)
        {
            double time=timeTrial(N);
            StdOut.printf("%15d %12.4f  ",N,time);
            StdOut.printf("%5.1f\n",time/prev);
            prev=time;
        }
    }
}
